<template>
  <div>
    <div class="container">
      <item  v-for="item of list" :key="item.id" :data="item"> </item>
    </div>
  </div>
</template>

<script>
import item from "./component/item.vue";
export default {
  data() {
    return {
      list: [],
    };
  },
  components: {
    item,
  },
  mounted() {
    // console.log(this.$route.query);
    var { title } = this.$route.query;
    if (title === "热门歌曲") {
      this.$http("http://47.108.197.28:3000/top/playlist/highquality").then(
        (res) => {
          res.data.playlists.forEach((item) => {
            var { coverImgUrl } = item;
            item.picUrl = coverImgUrl;
          });
          this.list = res.data.playlists.slice(3,);
        }
      );
    } else if (title === "最新音乐") {
      this.$http("http://47.108.197.28:3000/album/newest").then((res) => {
        this.list = res.data.albums.slice(3,);
      });
    } else if (title === "主播电台") {
      this.$http("http://47.108.197.28:3000/personalized/djprogram").then(
        (res) => {
          this.list = res.data.result.slice(3,);
        }
      );
    }
  },
};
</script>

<style>
</style>